package com.kepennar.application.domain;

import java.io.Serializable;
import javax.persistence.*;
import java.util.Set;


/**
 * The persistent class for the account database table.
 * 
 */
@Entity
@Table(name="account")
public class Account implements Serializable {
	private static final long serialVersionUID = 1L;
	private int idAccount;
	private String email;
	private String login;
	private String password;
	private Set<Role> roles;
	private Set<Comment> comments;
	private Set<Event> events;
	private Set<Invitation> invitations;

    public Account() {
    }


	@Id
	@Column(name="id_account", unique=true, nullable=false)
	public int getIdAccount() {
		return this.idAccount;
	}

	public void setIdAccount(int idAccount) {
		this.idAccount = idAccount;
	}


	@Column(nullable=false, length=255)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}


	@Column(nullable=false, length=255)
	public String getLogin() {
		return this.login;
	}

	public void setLogin(String login) {
		this.login = login;
	}


	@Column(nullable=false, length=255)
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}


	//bi-directional many-to-many association to Role
    @ManyToMany
	@JoinTable(
		name="account_role"
		, joinColumns={
			@JoinColumn(name="id_account", nullable=false)
			}
		, inverseJoinColumns={
			@JoinColumn(name="id_role", nullable=false)
			}
		)
	public Set<Role> getRoles() {
		return this.roles;
	}

	public void setRoles(Set<Role> roles) {
		this.roles = roles;
	}
	

	//bi-directional many-to-one association to Comment
	@OneToMany(mappedBy="account")
	public Set<Comment> getComments() {
		return this.comments;
	}

	public void setComments(Set<Comment> comments) {
		this.comments = comments;
	}
	

	//bi-directional many-to-one association to Event
	@OneToMany(mappedBy="account")
	public Set<Event> getEvents() {
		return this.events;
	}

	public void setEvents(Set<Event> events) {
		this.events = events;
	}
	

	//bi-directional many-to-one association to Invitation
	@OneToMany(mappedBy="account")
	public Set<Invitation> getInvitations() {
		return this.invitations;
	}

	public void setInvitations(Set<Invitation> invitations) {
		this.invitations = invitations;
	}
	
}